home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk12 / pspool1.0 / print_spool.doc < prev    next >
Text File  |  1995-03-18  |  21KB  |  516 lines

  1.  
  2.         Print_Spool.doc    V1.0.0    27-Mar-1988    ) Frangois Gagnon
  3.  
  4.  
  5.         Contents
  6.  
  7.                 1. Copyright Notice
  8.                 2. Introduction
  9.                 3. Technical Support
  10.                 4. Spool Program Startup
  11.                 5. Spool Program Execution
  12.                 6. Print Program Operation
  13.                    6.1 Action Requests
  14.                    6.2 File Requests
  15.                    6.3 Printing Options
  16.                 7. Print and Spool Error Messages
  17.                    7.1 Spool Internal Errors
  18.                    7.2 Print Internal Errors
  19.                    7.3 Print External Errors
  20.                 8. Restrictions and Improvements
  21.                 9. Character Tabulation
  22.  
  23.  
  24.         [1m1. Copyright Notice[0m
  25.  
  26.         Copyright ) 1988  Frangois Gagnon,  All Rights Reserved.
  27.  
  28.         The author does not make any warranty expressed or implied,
  29.         or assumes any liability or responsiblity for the use of this
  30.         software.
  31.  
  32.         Permission is hereby granted to copy, reproduce, redistribute
  33.         or otherwise use this software as long as it is for non-profit.
  34.         This notice and the above copyright notice must remain intact
  35.         and appear on all copies.
  36.  
  37.         Permission is also granted to correct any problems with this
  38.         software, but modifications and improvements are reserved by
  39.         the author.
  40.  
  41.  
  42.         [1m2. Introduction[0m
  43.  
  44.         The purpose of the Print_Spool package is to provide the Amiga
  45.         with a printer spooler for ASCII files. It is made of two programs
  46.         working in a master-slave relationship. The Print program is the
  47.         master and is called by the user whenever he wants to interact
  48.         with the spooler. The Spool program is the slave and executes in
  49.         the background printing files and awaiting the masters requests.
  50.  
  51.         The Spool program provides two major facilities to the user. The
  52.         first one is the handling of a printing queue which is used to
  53.         schedule multiple files in advance. The second one is the ability
  54.         to specify individual printing characteristics for each file.
  55.         These include the paper format, character type and size to use
  56.         and the ability to add page headers and line numbers to the file.
  57.  
  58.  
  59.         [1m3. Technical Support[0m
  60.  
  61.         I will be happy to receive any comments you may have on the
  62.         behaviors and the performances of both programs. Any improvements
  63.         will be evaluated according to their complexity, their usefulness
  64.         to all users, the available time and my own needs of the programs.
  65.  
  66.         If other programmers want to include an interface in their public
  67.         domain program with the Spool program, it will become an asset to
  68.         the Amiga community.
  69.  
  70.  
  71.                         Frangois Gagnon
  72.                         668 Paul VI
  73.                         Terrbonne, Quebec
  74.                         J6W 1W1, Canada
  75.  
  76.                 Usenet: gagnon@zap.uucp  or  gagnon@cae.uucp
  77.  
  78.  
  79.         [1m4. Spool Program Startup[0m
  80.  
  81.         Although the Spool program can be started at any time, it is
  82.         suggested that it be started in your Startup-Sequence. The program
  83.         does not tie any resources except memory while it has no file to
  84.         print. This makes it a suitable memory resident program.
  85.  
  86.         This program as only one argument which is the name of the file
  87.         to use for logging the printing operation. The default is a file
  88.         called RAM:Spool.log but could be any valid file that can be
  89.         opened in "append" mode including NIL:.
  90.  
  91.                 > run Spool RAM:Spool.log
  92.  
  93.         The log file does not remain opened while the program is running,
  94.         instead it is opened in "append" mode every time there is an
  95.         information to add. This allows the user to look at file as
  96.         needed and even to delete it if it becomes to large.
  97.  
  98.         The Spool program looks at the preference information for some
  99.         initial values. These only include the paper formats: (refer to
  100.         the CHANGE request)
  101.  
  102.                 narrow (8 inches)    <-->  wide (13 inches)
  103.                 short  (8.5 inches)  <-->  long (11 inches)
  104.  
  105.  
  106.         [1m5. Spool Program Execution[0m
  107.  
  108.         The Spool program follows a finite automaton to perform its
  109.         operation. This means that the program can only be in a finite
  110.         number of state during all of its execution (see the REPORT
  111.         request). You should refer to the source code of the Spool
  112.         program for more details on the relationship between the states
  113.         and the requests.
  114.  
  115.         Spool: Waiting for a file to print.
  116.  
  117.         While in this state, the printing queue is empty and the program
  118.         is waiting for an INSERT request which will specify a new file to
  119.         print. In the mean time, the printer device can be used by other
  120.         program.
  121.  
  122.         Spool: Waiting for a change of paper.
  123.  
  124.         The Spool program goes into this state when the paper format for
  125.         the next file to print does not match the one currently in the
  126.         printer. Upon startup, the program expect the paper in the printer
  127.         to be of the format specified in prerefence. The Spool program
  128.         must be notify using the CHANGE request when the paper matches
  129.         the format required by the next file.
  130.  
  131.         Spool: Waiting to access the printer.
  132.  
  133.         The Spool program goes into this state when the printer is not
  134.         available to print a new file. This usualy means that the printer
  135.         is being used by another program. The Spool program will retry
  136.         every 5 seconds until it succeeds.
  137.  
  138.         Spool: Printing a requested file.
  139.  
  140.         While in this state, the program is printing one of the requested
  141.         files. The printing options used throught the file are the ones
  142.         specified when it started to print the file. Those options could
  143.         be changed for the current file using the UPDATE request but will
  144.         only be used for the following copies, if there some left to do
  145.         for the file.
  146.  
  147.         Spool: Printing but will pause after the file.
  148.  
  149.         While in this state, the program is also printing one of the
  150.         requested files. The rules of the previous state still apply but
  151.         the Spool program will suspend itself after the current copy of
  152.         a file is printed.
  153.  
  154.         Spool: Pausing between two files.
  155.  
  156.         While in this state, the Spool program is suspended and is waiting
  157.         for a RESUME request to start printing a new file if there is one.
  158.         The printer device is available for use by other programs.
  159.  
  160.         Spool: Pausing in the middle of a file.
  161.  
  162.         The Spool program goes into this state when a FREEZE request is
  163.         received and it is currently printing a file. The access to the
  164.         printer device is still active but no new data is sent. The
  165.         printer will normally empty its own buffer before truly stopping.
  166.         The Spool program can be resumed using the RESUME or the FINISH
  167.         request.
  168.  
  169.  
  170.         [1m6. Print Program Operation[0m
  171.  
  172.         The Print program can be used at any time and even multiple time
  173.         simultaneously. Its purpose it to analyze the command line for
  174.         arguments, send the corresponding requests to the Spool program,
  175.         wait for the results, and display them to the user.
  176.  
  177.         There are two types of arguments in a command line. A command
  178.         always starts with the minus sign while all other arguments are
  179.         file specifiers. Lower case and upper case are equivalent for
  180.         all arguments and abbreviation are accepted in command names.
  181.         The '?' and '*' are the only wild character accepted by the
  182.         program but there is a maximum of ten '*' per file specifier.
  183.  
  184.         There are three kinds of commands supported by the Print program.
  185.         The first group are requests that will be immediately executed by
  186.         the Spool program. The second group define the operation to
  187.         perform when a file specifiers appear on the command line. The
  188.         last group are commands which modifies the options that are used
  189.         by the Spool program to print a file.
  190.  
  191.         If no argument appears on the command line, the REPORT request
  192.         will be automatically executed. The two following command lines
  193.         are equivalent.
  194.  
  195.                 > Print
  196.                 > Print -report
  197.  
  198.  
  199.         [1m6.1 Action Requests[0m
  200.  
  201.         The following commands are used to control the Spool program
  202.         activity.
  203.  
  204.         -report
  205.  
  206.         This command requests that the status of Spool program and the
  207.         contents of print queue be displayed on the screen. The options
  208.         of the files are included in the list.
  209.  
  210.         -return
  211.  
  212.         This command resquests that the flag telling the Spool program
  213.         if it must terminate be toggled. The program only terminates
  214.         when there are no more files to print and the flag is set. The
  215.         program will continue to accept requests until it does terminate.
  216.  
  217.         -change
  218.  
  219.         This command tells the Spool program that the paper format on the
  220.         printer matches the requirements of the next file in the queue.
  221.  
  222.         -freeze
  223.  
  224.         This command requests that the Spool program suspends its activity
  225.         even if it is currently printing a file. All the internal
  226.         information are preserved allowing the printing to be resumed from
  227.         the point it was frozen.
  228.  
  229.         -finish
  230.  
  231.         This command requests that the Spool program suspends its activity
  232.         after it finishes printing the current file. The operation will
  233.         be immediate if it is not printing a file. This request is useful
  234.         if you need to use the printer for some other activity.
  235.  
  236.         -reset
  237.  
  238.         This command requests that the Spool program stops printing
  239.         the current file but does not record it as printed. The Spool
  240.         program will also become suspended awaiting new requests. This
  241.         request is useful if you did not properly set the option before
  242.         asking it to print a file. Yous can update the option and then
  243.         resume the printing.
  244.  
  245.         -cancel
  246.  
  247.         This command requests that the Spool program stops printing
  248.         the current file and does record it as printed. The Spool
  249.         program will also become suspended awaiting new requests.
  250.  
  251.         -resume
  252.  
  253.         This command requests that the Spool program resumes its
  254.         activity after being suspended by one of the previous requests.
  255.  
  256.  
  257.         [1m6.2 File Requests[0m
  258.  
  259.         If none of these three commands appear on the command line
  260.         before a file specifier is used, the INSERT request will be
  261.         used automatically. The two following commands are equivalent.
  262.  
  263.                 > Print *.c
  264.                 > Print -insert *.c
  265.  
  266.  
  267.         -insert 
  268.  
  269.         For every file specifier following this command, the specified
  270.         directory is searched for matching files. The resulting file
  271.         list is sent to the Spool program for insertion at the end of
  272.         the queue. The options used for all files of a specifier are
  273.         the ones current when the specifier is encountered on the line.
  274.  
  275.                 > Print -insert Print.hlp
  276.  
  277.         -update
  278.  
  279.         For every file specifier following this command, the specified
  280.         directory is searched for matching files. The resulting file
  281.         list is sent to the Spool program to be used as a search list
  282.         for updating the queue. The list is then reported back with a
  283.         flag indicating if the file was found in the queue. The new
  284.         options used for all files of a specifier are the ones current
  285.         when the specifier is encountered on the line.
  286.  
  287.                 > Print -update -2 *.h -cpi12 -1 *.c
  288.  
  289.         -remove
  290.  
  291.         For every file specifier following this command, the file
  292.         specifier is sent as is to the Spool program. It is used as
  293.         a pattern to search the queue for matching files which are
  294.         immediately removed and reported back to the user.
  295.  
  296.                 > Print -remove *.h *Print_Spool/*
  297.  
  298.  
  299.         [1m6.3 Printing Options[0m
  300.  
  301.         The initial values of most of the printing options are extracted
  302.         from the preference information. They include paper formats, text
  303.         density and text style. All other initial values are hardcoded in
  304.         the Print program.
  305.  
  306.         These options remain effective for the duration of the Print
  307.         program execution or until they are changed by other commands.
  308.         All of the option apply to a complete file but your file may
  309.         contain printer commands. However, it is not recommanded that
  310.         the page length or the line density be changed.
  311.  
  312.         -cpi10      -cpi12      -cpi17
  313.  
  314.         These three commands allow you to specify the character density.
  315.         The number indicates the number of character per inch on a line.
  316.  
  317.         -lpi6       -lpi8
  318.  
  319.         These two commands allow you to specify the line density. The
  320.         number indicates the number of lines per inch on a page.
  321.  
  322.         -narrow     -wide
  323.  
  324.         These two commands allow you to specify the width of the
  325.         required paper. Before starting to print a file, those values
  326.         are verified (see the CHANGE request). You can select between
  327.         8 inches and 13 inches.
  328.  
  329.         -short      -long
  330.  
  331.         These two commands allow you to specify the length of the
  332.         required paper. Before starting to print a file, those values
  333.         are verified (see the CHANGE request). You can select between
  334.         8.5 inches and 11 inches.
  335.  
  336.         -draft      -letter
  337.  
  338.         These two commands allow you to specify the character quality
  339.         to use for printing the file.
  340.  
  341.         -header
  342.  
  343.         This command controls a toggle which indicates if the Spool
  344.         program must add page headers to the file. The header comtains
  345.         the date the file was created, the full name of the file and
  346.         the current page number. The headers are added by default.
  347.  
  348.         -number
  349.  
  350.         This command controls a toggle which indicates if the Spool
  351.         program must add line numbers to the file. This field is
  352.         exactly 8 characters to preserve the tabulation. The numbers
  353.         are added by default.
  354.  
  355.         -####
  356.  
  357.         This command is used to indicate the number of copies to print
  358.         of a file. The #### represents the number you type in and
  359.         obviously the minus sign is not part of the number. A value of
  360.         zero is valid and cause the file not to be printed when its
  361.         turn comes.
  362.  
  363.         -keep       -delete
  364.  
  365.         These two commands allow you to specify what to do with the
  366.         file when the last copy has been printed. The file will be
  367.         kept by default.
  368.  
  369.  
  370.         [1m7. Print and Spool Error Messages[0m
  371.  
  372.         This section describes all the possible error messages from both
  373.         programs. The reason and a solution are also given when possible.
  374.  
  375.  
  376.         [1m7.1 Spool Internal Errors[0m
  377.  
  378.         Spool: Unable to access log file.
  379.  
  380.         This message means that the Spool program could not access the
  381.         specified log file. The file name could be illegal or the media
  382.         could be of wrong type or write protected.
  383.  
  384.         Spool: Spool is already running.
  385.  
  386.         This message means that another copy of the Spool program is
  387.         already executing or more precisely that a port already exists
  388.         with the Spool program communication port name.
  389.  
  390.         Spool: Unable to create a port.
  391.  
  392.         This message means that the Spool program could not create the
  393.         required communication port. Verify if you are not running out
  394.         of memory.
  395.  
  396.  
  397.         [1m7.2 Print Internal Errors[0m
  398.  
  399.         Print: Unable to find Spool port.
  400.  
  401.         This message means that the Print program could not access the
  402.         Spool program communication port. Usually, it means that the
  403.         Spool program is not currently running and need to be started.
  404.         It could also mean that the Print program was used to soon after
  405.         starting up the Spool program.
  406.  
  407.         Print: Mismatched protocol versions.
  408.  
  409.         This message means the Print and the Spool program do not use
  410.         the same version of the communication protocol. Verify if you
  411.         use the most recent version of both programs.
  412.  
  413.         Print: Unable to create Print port.
  414.  
  415.         This message means that the Print program could not create the
  416.         port that will be used to receive the results of the requests.
  417.         Verify if you are not running out of memory.
  418.  
  419.         Print: Unable to allocate memory.
  420.  
  421.         This message means that you are running out of memory.
  422.  
  423.  
  424.         [1m7.3 Print External Errors[0m
  425.  
  426.         Print: Unknown or ambiguous command =
  427.  
  428.         This message means that the specified command is unknown to the
  429.         Print program. Verify the spelling and the list of commands or
  430.         supply more characters.
  431.  
  432.         Print: File not found =
  433.  
  434.         This message means that the specified file could not be found.
  435.         Verify the spelling and the specified path.
  436.  
  437.         Print: Wrong file type =
  438.  
  439.         This message means that the specified file is a directory and
  440.         is not suitable for printing. If you want to print the contents
  441.         of a directory, execute you favorite directory command and send
  442.         the result to the RAM disk. Then use the print command with the
  443.         DELETE option and the file will be deleted as soon as it is
  444.         printed.
  445.  
  446.         Print: File name too long =
  447.  
  448.         This message means that the resulting full file name is too long
  449.         for the internal buffer. You will have to rename the file or
  450.         directory names in the path to reduce the resulting length.
  451.  
  452.  
  453.         [1m8. Restrictions and Improvements[0m
  454.  
  455.         The protocol between the two programs restricts the full name
  456.         of a file to 96 characters but only 42 can appear on a page
  457.         header. This could be changed by adding a second line in the
  458.         header for the file name if many users request it.
  459.  
  460.         The Spool program does not currently use full asynchronous
  461.         operation with the file system and the printer device. This
  462.         means that the program can only check the communication port
  463.         between printing lines. Delays in response time for the Print
  464.         program could be introduced by the Spool program and the file
  465.         system.
  466.  
  467.         The Spool program does not execute as a completely independant
  468.         process. This means that the program still keeps the three
  469.         default files (stdin, stdout and stderr) opened as provided
  470.         by the process that starts the program. There is new "detach"
  471.         declaration provided with MANX 3.6a which I will probably
  472.         investigate.
  473.  
  474.         The full file name is used internally to specify a file to be
  475.         printed. The file can be deleted or replaced without the Spool
  476.         program knowing it (this only applies if the program is not
  477.         currently printing that file). If the file is replaced, the
  478.         size that is displayed for information and the date that appears
  479.         in the page header will be invalid.
  480.  
  481.         The Print program does not currently have a Workbench interface.
  482.         I will welcome all well designed and well written programs that
  483.         would provide such an interface to the Spool program. The Print
  484.         and the Spool programs can be used as reference for the complete
  485.         definition of the protocol.
  486.  
  487.  
  488.         [1m9. Character Tabulation[0m
  489.  
  490.         Some printers do not set the default tabulation to every eight
  491.         columns. If yours does not, you may have some problems printing
  492.         file that contains such character.
  493.  
  494.         If you are not sure about your printer, you can verify using the
  495.         "Tabs.dat" file provided with this package. The last two lines
  496.         of the file should printout identical if the tabs are properly
  497.         set. You can simply use one the following commands to test your
  498.         printer alone.
  499.  
  500.                 > copy Tabs.dat par:
  501.                 > copy Tabs.dat ser:
  502.  
  503.         You should also print the file using the Print and Spool programs
  504.         to make sure the tabs are properly initialized by the printer
  505.         driver. (This only works if the file has not been modify by any
  506.         communication programs)
  507.  
  508.                 > run Spool
  509.                 > wait 5
  510.                 > Print -header -number Tabs.dat
  511.  
  512.         The Spool program currently sends the "aTBSALL" printer commands
  513.         to set the default tabs. If that does not work for you, you will
  514.         have to modify the Spool program at the place that it initializes
  515.         the printer.
  516.